package com.bmft.ftcloud.model.entity;


import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

import static com.baomidou.mybatisplus.annotation.IdType.AUTO;

/**
 * entity 就是对应数据库的表.
 * @author Jarvan
 * @version 1.0
 * @create 2020/11/28 10:23
 */
@TableName(value = "sys_user")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SysUser {
    /**
     * User id 这里使用id一直报错，我们直接删掉id，在MySQL里面设置自增即可.
     */

    /**
     * Username folder name
     */
    private String username;
    /**
     * Password
     */
    private String password;
    /**
     * Email
     */
    private String email;
    /**
     * 角色码比如admin
     */
    private String roleCode;
    /**
     * 角色名称 比如管理员
     */
    private String roleName;
    /**
     * Create time 自动填充create
     */
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    /**
     * Modify time 自动填充 create and update
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date modifyTime;
    /**
     * Nickname 别名
     */
    private String nickname;
    /**
     * Deleted 逻辑删除
     */
    @TableLogic
    private int deleted;
    /**
     * Version 乐观锁
     * 版本控制
     */
    @Version
    private int version;

    public SysUser(String username, String password, String email, String roleCode, String roleName, String nickname) {
        this.username = username;
        this.password = password;
        this.email = email;
        this.roleCode = roleCode;
        this.roleName = roleName;
        this.nickname = nickname;
    }
}
